
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Api &mdash; Flask_Dashed 0.1b documentation</title>
    
    <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1b',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="top" title="Flask_Dashed 0.1b documentation" href="index.html" />
    <link rel="prev" title="欢迎来到 Flask_Dashed 的文档!" href="index.html" /> 
  </head>
  <body>
  
  


    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="api">
<h1>Api<a class="headerlink" href="#api" title="Permalink to this headline">¶</a></h1>
<div class="section" id="admin">
<h2>Admin 对象<a class="headerlink" href="#admin" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="admin.Admin">
<em class="property">class </em><tt class="descclassname">admin.</tt><tt class="descname">Admin</tt><big>(</big><em>app</em>, <em>url_prefix='/admin'</em>, <em>title='flask-dashed'</em>, <em>main_dashboard=None</em>, <em>endpoint='admin'</em><big>)</big><a class="reference internal" href="_modules/admin.html#Admin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.Admin" title="Permalink to this definition">¶</a></dt>
<dd><p>Class that provides a way to add admin interface to Flask applications.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>app</strong> &#8211; The Flask application</li>
<li><strong>url_prefix</strong> &#8211; The url prefix</li>
<li><strong>main_dashboard</strong> &#8211; The main dashboard object</li>
<li><strong>endpoint</strong> &#8211; The endpoint</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="admin.Admin.add_path_security">
<tt class="descname">add_path_security</tt><big>(</big><em>path</em>, <em>function</em>, <em>http_code=403</em><big>)</big><a class="reference internal" href="_modules/admin.html#Admin.add_path_security"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.Admin.add_path_security" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers security function for given path.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>path</strong> &#8211; The endpoint to secure</li>
<li><strong>function</strong> &#8211; The security function</li>
<li><strong>http_code</strong> &#8211; The response http code</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="admin.Admin.check_path_security">
<tt class="descname">check_path_security</tt><big>(</big><em>path</em><big>)</big><a class="reference internal" href="_modules/admin.html#Admin.check_path_security"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.Admin.check_path_security" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks security for specific and path.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>path</strong> &#8211; The path to check</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="admin.Admin.register_module">
<tt class="descname">register_module</tt><big>(</big><em>module_class</em>, <em>url_prefix</em>, <em>endpoint</em>, <em>short_title</em>, <em>title=None</em>, <em>parent=None</em><big>)</big><a class="reference internal" href="_modules/admin.html#Admin.register_module"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.Admin.register_module" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers new module to current admin.</p>
</dd></dl>

<dl class="method">
<dt id="admin.Admin.register_node">
<tt class="descname">register_node</tt><big>(</big><em>url_prefix</em>, <em>endpoint</em>, <em>short_title</em>, <em>title=None</em>, <em>parent=None</em>, <em>node_class=&lt;class 'admin.AdminNode'&gt;</em><big>)</big><a class="reference internal" href="_modules/admin.html#Admin.register_node"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.Admin.register_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers admin node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>url_prefix</strong> &#8211; The url prefix</li>
<li><strong>endpoint</strong> &#8211; The endpoint</li>
<li><strong>short_title</strong> &#8211; The short title</li>
<li><strong>title</strong> &#8211; The long title</li>
<li><strong>parent</strong> &#8211; The parent node path</li>
<li><strong>node_class</strong> &#8211; The class for node objects</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="id1">
<h2>Admin 模块<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="admin.recursive_getattr">
<tt class="descclassname">admin.</tt><tt class="descname">recursive_getattr</tt><big>(</big><em>obj</em>, <em>attr</em><big>)</big><a class="reference internal" href="_modules/admin.html#recursive_getattr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.recursive_getattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns object related attributes, as it&#8217;s a template filter None
is return when attribute doesn&#8217;t exists.</p>
<p>eg:</p>
<div class="highlight-python"><pre>a = object()
a.b = object()
a.b.c = 1
recursive_getattr(a, 'b.c') =&gt; 1
recursive_getattr(a, 'b.d') =&gt; None</pre>
</div>
</dd></dl>

<dl class="class">
<dt id="admin.AdminNode">
<em class="property">class </em><tt class="descclassname">admin.</tt><tt class="descname">AdminNode</tt><big>(</big><em>admin</em>, <em>url_prefix</em>, <em>endpoint</em>, <em>short_title</em>, <em>title=None</em>, <em>parent=None</em><big>)</big><a class="reference internal" href="_modules/admin.html#AdminNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminNode" title="Permalink to this definition">¶</a></dt>
<dd><p>An AdminNode just act as navigation container, it doesn&#8217;t provide any
rules.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>admin</strong> &#8211; The parent admin object</li>
<li><strong>url_prefix</strong> &#8211; The url prefix</li>
<li><strong>enpoint</strong> &#8211; The endpoint</li>
<li><strong>short_title</strong> &#8211; The short module title use on navigation
&amp; breadcrumbs</li>
<li><strong>title</strong> &#8211; The long title</li>
<li><strong>parent</strong> &#8211; The parent node</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="admin.AdminNode.parents">
<tt class="descname">parents</tt><a class="reference internal" href="_modules/admin.html#AdminNode.parents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminNode.parents" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns all parent hierarchy as list. Usefull for breadcrumbs.</p>
</dd></dl>

<dl class="method">
<dt id="admin.AdminNode.secure">
<tt class="descname">secure</tt><big>(</big><em>http_code=403</em><big>)</big><a class="reference internal" href="_modules/admin.html#AdminNode.secure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminNode.secure" title="Permalink to this definition">¶</a></dt>
<dd><p>Gives a way to secure specific url path.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>http_code</strong> &#8211; The response http code when False</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="admin.AdminNode.url_path">
<tt class="descname">url_path</tt><a class="reference internal" href="_modules/admin.html#AdminNode.url_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminNode.url_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the url path relative to admin one.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="admin.AdminModule">
<em class="property">class </em><tt class="descclassname">admin.</tt><tt class="descname">AdminModule</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/admin.html#AdminModule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminModule" title="Permalink to this definition">¶</a></dt>
<dd><p>Class that provides a way to create simple admin module.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>admin</strong> &#8211; The parent admin object</li>
<li><strong>url_prefix</strong> &#8211; The url prefix</li>
<li><strong>enpoint</strong> &#8211; The endpoint</li>
<li><strong>short_title</strong> &#8211; the short module title use on navigation
&amp; breadcrumbs</li>
<li><strong>title</strong> &#8211; The long title</li>
<li><strong>parent</strong> &#8211; The parent node</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="admin.AdminModule.add_url_rule">
<tt class="descname">add_url_rule</tt><big>(</big><em>rule</em>, <em>endpoint</em>, <em>view_func</em>, <em>**options</em><big>)</big><a class="reference internal" href="_modules/admin.html#AdminModule.add_url_rule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminModule.add_url_rule" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds a routing rule to the application from relative endpoint.
<cite>view_class</cite> is copied as we need to dynamically apply decorators.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>rule</strong> &#8211; The rule</li>
<li><strong>endpoint</strong> &#8211; The endpoint</li>
<li><strong>view_func</strong> &#8211; The view</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="admin.AdminModule.secure_endpoint">
<tt class="descname">secure_endpoint</tt><big>(</big><em>endpoint</em>, <em>http_code=403</em><big>)</big><a class="reference internal" href="_modules/admin.html#AdminModule.secure_endpoint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminModule.secure_endpoint" title="Permalink to this definition">¶</a></dt>
<dd><p>Gives a way to secure specific url path.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>endpoint</strong> &#8211; The endpoint to protect</li>
<li><strong>http_code</strong> &#8211; The response http code when False</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="admin.AdminModule.url">
<tt class="descname">url</tt><a class="reference internal" href="_modules/admin.html#AdminModule.url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#admin.AdminModule.url" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns first registered (main) rule as url.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="sqlalchemy">
<h2>SQLAlchemy 扩展<a class="headerlink" href="#sqlalchemy" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="ext.sqlalchemy.ModelAdminModule">
<em class="property">class </em><tt class="descclassname">ext.sqlalchemy.</tt><tt class="descname">ModelAdminModule</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule" title="Permalink to this definition">¶</a></dt>
<dd><p>SQLAlchemy model admin module builder.</p>
<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.count_list">
<tt class="descname">count_list</tt><big>(</big><em>search=None</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.count_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.count_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Counts filtered list.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>search</strong> &#8211; The string for quick search</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.create_object">
<tt class="descname">create_object</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.create_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.create_object" title="Permalink to this definition">¶</a></dt>
<dd><p>New object instance new object.</p>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.delete_object">
<tt class="descname">delete_object</tt><big>(</big><em>object</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.delete_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.delete_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>object</strong> &#8211; The object to delete</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="ext.sqlalchemy.ModelAdminModule.edit_query_factory">
<tt class="descname">edit_query_factory</tt><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.edit_query_factory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.edit_query_factory" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns query for object edition.</p>
</dd></dl>

<dl class="attribute">
<dt id="ext.sqlalchemy.ModelAdminModule.form_view">
<tt class="descname">form_view</tt><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.form_view" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">ObjectFormView</span></tt></p>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.get_actions_for_object">
<tt class="descname">get_actions_for_object</tt><big>(</big><em>object</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.get_actions_for_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.get_actions_for_object" title="Permalink to this definition">¶</a></dt>
<dd><p>&#8220;Returns actions for object as and tuple list.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>object</strong> &#8211; The object</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.get_object">
<tt class="descname">get_object</tt><big>(</big><em>pk</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.get_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.get_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets back object by primary key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pk</strong> &#8211; The object primary key</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.get_object_list">
<tt class="descname">get_object_list</tt><big>(</big><em>search=None</em>, <em>order_by_name=None</em>, <em>order_by_direction=None</em>, <em>offset=None</em>, <em>limit=None</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.get_object_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.get_object_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns ordered, filtered and limited query.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>search</strong> &#8211; The string for search filter</li>
<li><strong>order_by_name</strong> &#8211; The field name to order by</li>
<li><strong>order_by_direction</strong> &#8211; The field direction</li>
<li><strong>offset</strong> &#8211; The offset position</li>
<li><strong>limit</strong> &#8211; The limit</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="ext.sqlalchemy.ModelAdminModule.list_query_factory">
<tt class="descname">list_query_factory</tt><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.list_query_factory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.list_query_factory" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns non filtered list query.</p>
</dd></dl>

<dl class="method">
<dt id="ext.sqlalchemy.ModelAdminModule.save_object">
<tt class="descname">save_object</tt><big>(</big><em>obj</em><big>)</big><a class="reference internal" href="_modules/ext/sqlalchemy.html#ModelAdminModule.save_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ext.sqlalchemy.ModelAdminModule.save_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Saves object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>object</strong> &#8211; The object to save</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
  
    <a href="http://github.com/jeanphix/Flask-Dashed"><img style="position: fixed; top: 0; right: 0; border: 0;"
    src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
  

  

  </body>
</html>